package com.example.im.bean.converters

import androidx.room.TypeConverter
import com.example.im.bean.FileInfo
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken

class FileConverters {
    @TypeConverter
    fun stringToObject(value: String?): FileInfo? {
        val fileType = object : TypeToken<FileInfo>() {

        }.type
        return Gson().fromJson(value, fileType)
    }

    @TypeConverter
    fun objectToString(file: FileInfo?): String? {
        val gson = Gson()
        return gson.toJson(file)
    }
}